/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Comparators;

import beans.Usuario;
import net.sourceforge.floggy.persistence.Comparator;
import net.sourceforge.floggy.persistence.Persistable;

/**
 *
 * @author Pedro Henrique
 */
public class UsuarioNomeComparator implements Comparator {

    public int compare(Persistable arg0, Persistable arg1) {
        Usuario u1 = (Usuario) arg0;
        Usuario u2 = (Usuario) arg1;

        int result = u1.getNome().compareTo(u2.getNome());

        if (result == 0) {
            return EQUIVALENT;
        } else if (result > 0) {
            return FOLLOWS;
        } else {
            return PRECEDES;
        }
    }
}
